home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 370 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: laurel.yorku.ca!ken
  2. From: ken@yorku.ca (Kenneth Kafieh)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Faster FILE subroutines in standard C?
  5. Date: 4 Jan 1996 04:34:05 GMT
  6. Organization: York University
  7. Message-ID: <4cflbt$d4h@sunburst.ccs.yorku.ca>
  8. References: <Pine.A32.3.91.960103111942.52249A-100000-100000-100000-100000-100000@afep.yorku.ca>
  9. NNTP-Posting-Host: laurel.yorku.ca
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Ken (ken@afep.yorku.ca) wrote:
  13.  
  14. : I found that I was able to get 3-4 time faster performance by using good 
  15. : old ANSI C file accessing routines (like  fgets, fseek, ftell, ...etc.)
  16. : instead of C++ streams (like ifstream::getline, fstream::seekg, ...etc.)
  17. : I wrote the program originally in C++ (a simple little phonebook for my
  18. : own use) and it took about 9 seconds to scan a 100Kb file for a 3 byte
  19. : string!!!  Fed up, I rewrote it in C and voila! Now it takes 2 secs!
  20. : I'm using Borland C++ v2.0.
  21.  
  22. : Does that sound right?  Maybe my code was inefficiently written?
  23. : I know C++ is generally slower than C but I didn't think that 
  24. : file stuff would be too.   What did I do wrong? Am I missing
  25. : something.  Maybe I'll post the code too, later. Has anyone
  26. : else noticed this too?
  27.  
  28. : Come to think of it, the coding in
  29. : C was cleaner looking, too.  
  30.  
  31. : -------------
  32. : And So Until Next Time...
  33.  
  34. :         I'm Ken
  35.  
  36.  
  37. --
  38.  
  39. And So Until Next Time...
  40.  
  41.         I'm Ken
  42.